<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">
    <ui:define name="head">
        <link type="text/css" href="#{request.contextPath}/UI/epss/epss.css" rel="stylesheet"/>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form">
            <p:growl id="msgs" showDetail="false"/>
            <p:commandButton id="addBtn"
                             value="增加" icon="ui-icon-plus"
                             rendered='#{itemCstplAction.strMngNotFinishFlag}'
                             action="#{itemCstplAction.resetActionForAdd()}"
                             update="pgViewForAdd,ptt,msgs,pcm"
                             onclick="PF('wVDlgViewForAdd').show()">
            </p:commandButton>
            <p:contextMenu id="pcm" for="ptt" rendered='#{itemCstplAction.strMngNotFinishFlag}'>
                <p:menuitem value="更新" icon="ui-icon-arrowrefresh-1-w"
                            actionListener="#{itemCstplAction.selectRecordAction('Upd')}"
                            update="pgViewForUpd,msgs,ptt,pcm"
                            oncomplete="PF('wVDlgViewForUpd').show()">
                </p:menuitem>
                <p:menuitem value="删除" icon="ui-icon-close"
                            actionListener="#{itemCstplAction.selectRecordAction('Del')}"
                            update="pgViewForDel,msgs,ptt,pcm"
                            oncomplete="PF('wVDlgViewForDel').show()">
                </p:menuitem>
                <p:menuitem value="FROM总包TO成本" icon="ui-icon-copy"
                            actionListener="#{itemCstplAction.selectRecordAction('From_tkctt_to_cstpl')}"
                            update="msgs,ptt,pcm">
                </p:menuitem>
            </p:contextMenu>
            <p:dataTable id="ptt" style="width:100%;"
                         value="#{itemCstplAction.cstplItemShowList}"
                         var="record"
                         rowKey="#{record.pkid}"
                         selection="#{itemCstplAction.cstplItemShowSelected}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="20"
                         rowsPerPageTemplate="200,100,50,40,30,20,15"
                         rowIndexVar="row"
                         emptyMessage="数据记录为空..."
                         rowStyleClass="#{record.name eq '合计'? 'rowDoneStyle': record.nameContrast eq '合计'? 'rowDoneStyle':
                                             record.name eq '总合计'? 'rowDoneStyle':record.nameContrast eq '总合计'? 'rowDoneStyle':null}"
                         scrollable="true">
                <p:column style="width:30px" headerText="序号">
                    <h:outputText value="#{row + 1}"/>
                </p:column>
                <p:column style="width:100px" headerText="总包编号">
                    <h:outputText value="#{record.strNo}" escape="false"/>
                </p:column>
                <p:column style="width:250px" headerText="总包名称">
                    <h:outputText value="#{record.name}" />
                </p:column>
                <p:column style="width:60px" headerText="总包单位">
                    <h:outputText value="#{record.unit}" style="text-align:right"/>
                </p:column>
                <p:column style="width:60px" headerText="总包单价">
                    <h:outputText value="#{record.contractUnitPrice}" style="float: right" >
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:60px" headerText="总包数量">
                    <h:outputText value="#{record.contractQuantity}" style="float: right">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:100px" headerText="总包金额">
                    <h:outputText value="#{record.contractAmount}" style="float: right">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>

                <!--成本计划-->
                <p:column style="width:100px" headerText="成本编号">
                    <h:outputText value="#{record.strNoContrast}" escape="false"/>
                </p:column>
                <p:column style="width:250px" headerText="成本名称">
                    <h:outputText value="#{record.nameContrast}" />
                </p:column>
                <p:column style="width:60px" headerText="成本单位">
                    <h:outputText value="#{record.unitContrast}" style="text-align:right"/>
                </p:column>
                <p:column style="width:80px" headerText="成本单价">
                    <h:outputText value="#{record.contractUnitPriceContrast}" style="float: right" >
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:80px" headerText="成本数量">
                    <h:outputText value="#{record.contractQuantityContrast}" style="float: right">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:100px" headerText="成本金额">
                    <h:outputText value="#{record.contractAmountContrast}" style="float: right">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:300px" headerText="成本备注">
                    <h:outputText value="#{record.noteContrast}" />
                </p:column>
            </p:dataTable>
            <p:dialog id="dlgViewForAdd" header="成本计划内容增加信息" widgetVar="wVDlgViewForAdd"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                <h:panelGrid id="pgViewForAdd">
                    <h:panelGrid columns="4">
                        <p:outputLabel for="noItemHieRelapForAdd" value="编号:" />
                        <h:inputText id="noItemHieRelapForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.strNo}">
                            <p:ajax event="blur" update="msgs,pgOperBtnForAdd,strCorrespondingItemNoForAdd"
                                    listener="#{itemCstplAction.blurStrNoToGradeAndOrderid('true')}"/>
                        </h:inputText>
                        <p:outputLabel for="nameForAdd" value="名称:" />
                        <p:selectOneMenu id="nameForAdd"
                                         value="#{itemCstplAction.cttItemShowAdd.name}"
                                         editable="true">
                            <f:selectItem itemLabel="固定项输入时请选择下列名称" itemValue="" />
                            <f:selectItems value="#{esCommon.cstplItemNamelist}" />
                            <p:ajax update="msgs,pgViewForAdd"
                                    listener="#{itemCstplAction.blurStrName}"/>
                        </p:selectOneMenu>
                        <p:outputLabel for="unitItemInfoForAdd" value="单位:"/>
                        <h:inputText id="unitItemInfoForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.unit}"/>
                        <p:outputLabel for="noteForAdd" value="备注内容:" />
                        <h:inputText id="noteForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.note}"/>
                        <p:outputLabel for="contractUnitPriceItemInfoForAdd" value="合同单价:"/>
                        <h:inputText id="contractUnitPriceItemInfoForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.contractUnitPrice}"
                                     style="text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            <p:ajax event="blur" update="contractAmountItemInfoForAdd"
                                    listener="#{itemCstplAction.blurCalculateAmountAction}"/>
                        </h:inputText>
                        <p:outputLabel for="contractQuantityItemInfoForAdd" value="合同数量:"/>
                        <h:inputText id="contractQuantityItemInfoForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.contractQuantity}"
                                     style="text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            <p:ajax event="blur" update="contractAmountItemInfoForAdd"
                                    listener="#{itemCstplAction.blurCalculateAmountAction}"/>
                        </h:inputText>
                        <p:outputLabel for="contractAmountItemInfoForAdd" value="合同金额:"/>
                        <h:inputText id="contractAmountItemInfoForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.contractAmount}"
                                     readonly="true"
                                     style="background-color:gainsboro;text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:inputText>
                        <p:outputLabel for="strCorrespondingItemNoForAdd" value="对应编号:" />
                        <h:inputText id="strCorrespondingItemNoForAdd"
                                     value="#{itemCstplAction.cttItemShowAdd.strCorrespondingItemNo}">
                            <p:ajax event="blur" update="msgs"
                                    listener="#{itemCstplAction.blurCorrespondingPkid}"/>
                        </h:inputText>
                    </h:panelGrid>
                    <h:panelGrid id="pgOperBtnForAdd" columns="2">
                        <p:commandButton id="submitBtnForAdd"
                                         value="提交（增加）"
                                         action="#{itemCstplAction.submitThisRecordAction}"
                                         update="pgViewForAdd,ptt,msgs">
                        </p:commandButton>
                        <p:commandButton id="resetBtnForAdd" value="重置"
                                         type="reset"
                                         update="pgViewForAdd">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
            <p:dialog id="dlgViewForUpd" header="成本计划内容更新信息" widgetVar="wVDlgViewForUpd"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                <h:panelGrid id="pgViewForUpd">
                    <h:panelGrid columns="4">
                        <p:outputLabel for="noItemHieRelapForUpd" value="编号:" />
                        <h:inputText id="noItemHieRelapForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.strNo}">
                            <p:ajax event="blur" update="msgs,pgOperBtnForUpd,strCorrespondingItemNoForUpd"
                                    listener="#{itemCstplAction.blurStrNoToGradeAndOrderid('true')}"/>
                        </h:inputText>
                        <p:outputLabel for="nameForUpd" value="名称:" />
                        <p:selectOneMenu id="nameForUpd"
                                         value="#{itemCstplAction.cttItemShowUpd.name}"
                                         editable="true">
                            <f:selectItem itemLabel="固定项输入时请选择下列名称" itemValue="" />
                            <f:selectItems value="#{esCommon.cstplItemNamelist}" />
                            <p:ajax update="msgs,pgViewForUpd"
                                    listener="#{itemCstplAction.blurStrName}"/>
                        </p:selectOneMenu>
                        <p:outputLabel for="unitItemInfoForUpd" value="单位:"/>
                        <h:inputText id="unitItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.unit}"/>
                        <p:outputLabel for="noteForUpd" value="备注内容:" />
                        <h:inputText id="noteForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.note}"/>
                        <p:outputLabel for="contractUnitPriceItemInfoForUpd" value="合同单价:"/>
                        <h:inputText id="contractUnitPriceItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.contractUnitPrice}"
                                     style="text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            <p:ajax event="blur" update="contractAmountItemInfoForUpd"
                                    listener="#{itemCstplAction.blurCalculateAmountAction}"/>
                        </h:inputText>
                        <p:outputLabel for="contractQuantityItemInfoForUpd" value="合同数量:"/>
                        <h:inputText id="contractQuantityItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.contractQuantity}"
                                     style="text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            <p:ajax event="blur" update="contractAmountItemInfoForUpd"
                                    listener="#{itemCstplAction.blurCalculateAmountAction}"/>
                        </h:inputText>
                        <p:outputLabel for="contractAmountItemInfoForUpd" value="合同金额:"/>
                        <h:inputText id="contractAmountItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.contractAmount}"
                                     readonly="true"
                                     style="background-color:gainsboro;text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:inputText>
                        <p:outputLabel for="strCorrespondingItemNoForUpd" value="对应编号:" />
                        <h:inputText id="strCorrespondingItemNoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.strCorrespondingItemNo}">
                            <p:ajax event="blur" update="msgs"
                                    listener="#{itemCstplAction.blurCorrespondingPkid}"/>
                        </h:inputText>
                        <p:outputLabel for="originFlagItemInfoForUpd" value="数据来源:" />
                        <h:inputText id="originFlagItemInfoForUpd"
                                     value="#{esCommon.originFlagListValueOfAlias(
                                 itemCstplAction.cttItemShowUpd.originFlag)}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdByItemInfoForUpd" value="创建人:" />
                        <h:inputText id="createdByItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.createdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdDateItemInfoForUpd" value="创建时间:" />
                        <h:inputText id="createdDateItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.createdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdByItemInfoForUpd" value="修改人:" />
                        <h:inputText id="lastUpdByItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.lastUpdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdDateItemInfoForUpd" value="修改时间:" />
                        <h:inputText id="lastUpdDateItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.lastUpdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="modificationNumItemInfoForUpd" value="修改次数:" />
                        <h:inputText id="modificationNumItemInfoForUpd"
                                     value="#{itemCstplAction.cttItemShowUpd.modificationNum}"
                                     style="background-color:gainsboro;text-align:right;" readonly="true">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0"/>
                        </h:inputText>
                    </h:panelGrid>
                    <h:panelGrid id="pgOperBtnForUpd" columns="2">
                        <p:commandButton id="submitBtnForUpd"
                                         value="提交（更新）"
                                         action="#{itemCstplAction.submitThisRecordAction}"
                                         update="pgViewForUpd,ptt,msgs">
                        </p:commandButton>
                        <p:commandButton id="resetBtnForUpd" value="重置"
                                         type="reset"
                                         update="pgViewForUpd">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
            <p:dialog id="dlgViewForDel" header="成本计划内容删除信息" widgetVar="wVDlgViewForDel"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                <h:panelGrid id="pgViewForDel">
                    <h:panelGrid columns="4">
                        <p:outputLabel for="noItemHieRelapForDel" value="编号:" />
                        <h:inputText id="noItemHieRelapForDel"
                                     value="#{itemCstplAction.cttItemShowDel.strNo}"
                                     readonly="true"
                                     style="background-color:gainsboro">
                        </h:inputText>
                        <p:outputLabel for="nameForDel" value="名称:" />
                        <h:inputText id="nameForDel"
                                     value="#{itemCstplAction.cttItemShowDel.name}"
                                     readonly="true"
                                     style="background-color:gainsboro">
                        </h:inputText>
                        <p:outputLabel for="unitItemInfoForDel" value="单位:"/>
                        <h:inputText id="unitItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.unit}"
                                     readonly="true"
                                     style="background-color:gainsboro"/>
                        <p:outputLabel for="noteForDel" value="备注内容:" />
                        <h:inputText id="noteForDel"
                                     value="#{itemCstplAction.cttItemShowDel.note}"
                                     readonly="true"
                                     style="background-color:gainsboro"/>
                        <p:outputLabel for="contractUnitPriceItemInfoForDel" value="合同单价:"/>
                        <h:inputText id="contractUnitPriceItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.contractUnitPrice}"
                                     readonly="true"
                                     style="background-color:gainsboro;text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            <p:ajax event="blur" update="contractAmountItemInfoForDel"
                                    listener="#{itemCstplAction.blurCalculateAmountAction}"/>
                        </h:inputText>
                        <p:outputLabel for="contractQuantityItemInfoForDel" value="合同数量:"/>
                        <h:inputText id="contractQuantityItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.contractQuantity}"
                                     readonly="true"
                                     style="background-color:gainsboro;text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            <p:ajax event="blur" update="contractAmountItemInfoForDel"
                                    listener="#{itemCstplAction.blurCalculateAmountAction}"/>
                        </h:inputText>
                        <p:outputLabel for="contractAmountItemInfoForDel" value="合同金额:"/>
                        <h:inputText id="contractAmountItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.contractAmount}"
                                     readonly="true"
                                     style="background-color:gainsboro;text-align:right;">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:inputText>
                        <p:outputLabel for="strCorrespondingItemNoForDel" value="对应编号:" />
                        <h:inputText id="strCorrespondingItemNoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.strCorrespondingItemNo}"
                                     readonly="true"
                                     style="background-color:gainsboro">
                            <p:ajax event="blur" update="msgs"
                                    listener="#{itemCstplAction.blurCorrespondingPkid}"/>
                        </h:inputText>
                        <p:outputLabel for="originFlagItemInfoForDel" value="数据来源:" />
                        <h:inputText id="originFlagItemInfoForDel"
                                     value="#{esCommon.originFlagListValueOfAlias(
                                 itemCstplAction.cttItemShowDel.originFlag)}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdByItemInfoForDel" value="创建人:" />
                        <h:inputText id="createdByItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.createdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdDateItemInfoForDel" value="创建时间:" />
                        <h:inputText id="createdDateItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.createdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdByItemInfoForDel" value="修改人:" />
                        <h:inputText id="lastUpdByItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.lastUpdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdDateItemInfoForDel" value="修改时间:" />
                        <h:inputText id="lastUpdDateItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.lastUpdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="modificationNumItemInfoForDel" value="修改次数:" />
                        <h:inputText id="modificationNumItemInfoForDel"
                                     value="#{itemCstplAction.cttItemShowDel.modificationNum}"
                                     style="background-color:gainsboro;text-align:right;" readonly="true">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0"/>
                        </h:inputText>
                    </h:panelGrid>
                    <h:panelGrid id="pgOperBtnForDel">
                        <p:commandButton id="submitBtnForDel"
                                         value="提交（删除）"
                                         action="#{itemCstplAction.submitThisRecordAction}"
                                         update="pgViewForDel,ptt,msgs">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
        </h:form>
    </ui:define>
</ui:composition>

<!--（1）输出的时间与原来的时间差8个小时,原因是没加上时间的属性,改成:
<h:outputText value="#{data.t_Date}">
    <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="GMT+8" locale="cn" />
</h:outputText>
加上 timeZone="GMT+8"之后，则显示正常的时间
（2）有的需要显示是12小时格式，有的需要显示24小时格式
主要在 pattern="yyyy-MM-dd HH:mm:ss"这句的hh上面，要是大写的HH则是24小时格式，小写hh则是12小时格式-->
